package com.gm.wj.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import javax.validation.constraints.NotEmpty;
import java.sql.Date;

/**
 * @program: wj
 * @description: 广告位管理
 * @author: Huang_shengjun
 * @create: 2020-08-21 00:43
 **/
@Data
@Entity
@Table(name = "sys_banner")
@ToString
@JsonIgnoreProperties({ "handler","hibernateLazyInitializer" })
// 软删除
@SQLDelete(sql = "update sys_banner set is_delete = 1 where id = ?")
@Where( clause = "is_delete = 0" )
public class SysBanner {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private int id;

    /**
     * 广告位名称
     */
    @NotEmpty(message = "广告位名称不能为空")
    private String name;

    /**
     * position位置
     */
    @NotEmpty(message = "广告位置不能为空")
    private String position;

    /**
     * 权重
     */
    private int weight;

    /**
     * 内部url地址
     */
    private String path;

    /**
     * 外部url地址
     */
    private String tourl;

    private String username;

    /**
     * 宣传语
     */
    @NotEmpty(message = "宣传语不能为空")
    private String slogan;

    /**
     * 图片地址
     */
    @NotEmpty(message = "图片地址不能为空")
    private String imageUrl;

    /**
     * 显示与否
     */
    private boolean display;

    /**
     * 创建时间
     */
    private String createTime;

    /**
     * 0-未删除，1-已删除
     */
    /**
     * 软删除
     */
    @Column(name="is_delete")
    private int isDelete;


}
